package cn.xz.zysjz.adapter;

import android.view.View;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import java.util.Objects;

import cn.xz.zysjz.R;
import cn.xz.zysjz.bean.KfBean;

/**
 * 在线聊天列表适配器*/
public class KfListAdapter extends BaseQuickAdapter<KfBean, BaseViewHolder> {

    public KfListAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, KfBean mListBean) {
        //对方
        TextView tv0 = helper.getView(R.id.tv0);
        tv0.setVisibility(View.GONE);
        //我
        TextView tv1 = helper.getView(R.id.tv1);
        tv1.setVisibility(View.GONE);
        if (Objects.equals(mListBean.getType(), "0")){
            tv0.setVisibility(View.VISIBLE);
            tv0.setText(mListBean.getValue());
        }else {
            tv1.setVisibility(View.VISIBLE);
            tv1.setText(mListBean.getValue());
        }

    }
}
